package com.erp.gather.controller;

import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.erp.gather.domain.*;
import com.erp.gather.domain.bo.ErpCollectProductBo;
import com.erp.gather.domain.bo.ErpCollectProductExpandBo;
import com.erp.gather.domain.bo.ErpCollectProductHsBo;
import com.erp.gather.domain.bo.ErpCollectProductUploadTestTaskBo;
import com.erp.gather.domain.vo.ErpCollectProductHsVo;
import com.erp.gather.domain.vo.ErpCollectProductVo;
import com.erp.gather.domain.vo.ErpSellerCollectProductVo;
import com.erp.gather.mapper.*;
import com.erp.gather.service.*;
import com.ruoyi.common.core.annotation.RepeatSubmit;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.core.web.oldController.BaseController;
import com.ruoyi.common.core.web.oldPage.TableDataInfo;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.gather.api.domain.ErpCollectProduct;
import com.ruoyi.gather.api.domain.ErpCollectProductExpand;
import com.ruoyi.gather.api.domain.ErpSellerCollectProduct;
import com.ruoyi.gather.api.domain.dto.ComputeFreightDto;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 采集商品;参考AE-商品：发布产品信息（aliexpress.postproduct.redefining.postaeproduct）
 *
 * @author erp
 * @date 2023-03-07
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/gather/collectProduct")
public class ErpCollectProductController extends BaseController {

    private final IErpCollectProductService iErpCollectProductService;
    private final ErpCollectProductMapper collectProductMapper;
    private final IErpCollectProductHsService collectProductHsService;
    private final IErpCollectProductCategoryService erpCollectProductCategoryService;
    private final ErpSellerReplaceImageRecordMapper erpSellerReplaceImageRecordMapper;
    private final IErpCollectProductUploadTestTaskService iErpCollectProductUploadTestTaskService;
    private final IErpSellerCollectProductService iErpSellerCollectProductService;
    private final ErpCollectProductUploadTestTaskMapper erpCollectProductUploadTestTaskMapper;
    private final IErpCollectProductSkuPriceService iErpCollectProductSkuPriceService;
    private final IErpCollectProductExpandService iErpCollectProductExpandService;
    private final ErpCollectProductExpandMapper collectProductExpandMapper;
    private final ErpSellerCollectProductMapper sellerCollectProductMapper;
    
    @GetMapping("/getCategoryByCollectId/{collectProductId}")
    public Map<String,Object> getCategoryByCollectId(@PathVariable("collectProductId") Long collectProductId) {
        String categoryEn = iErpCollectProductService.getCategoryEn(collectProductId);
        String categoryCN = iErpCollectProductService.getCategoryCN(collectProductId);
        Map<String, Object> map = new HashMap<>();
        map.put("categoryEn", categoryEn);
        map.put("categoryCN", categoryCN);
        return map;
    }

    @GetMapping("/list")
    public TableDataInfo<ErpCollectProductVo> list(ErpCollectProductBo bo, PageQuery pageQuery) {
        return iErpCollectProductService.queryPageList(bo, pageQuery);
    }

    @GetMapping("/{id}")
    public R<ErpCollectProductVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable("id") Long id) {
        return R.ok(iErpCollectProductService.queryById(id));
    }

    /**
     * 新增采集商品;参考AE-商品：发布产品信息（aliexpress.postproduct.redefining.postaeproduct）
     */
    @RepeatSubmit()
    @PostMapping()
    public R<Void> add(@Validated(AddGroup.class) @RequestBody ErpCollectProductBo bo) {
        return toAjax(iErpCollectProductService.insertByBo(bo));
    }

    /**
     * 新增采集商品;参考AE-商品：发布产品信息（aliexpress.postproduct.redefining.postaeproduct）
     */
    @RepeatSubmit()
    @PostMapping("/staging")
    public R<Void> staging(@Validated(AddGroup.class) @RequestBody ErpCollectProductBo bo) {
        return toAjax(iErpCollectProductService.staging(bo));
    }

    /**
     * 修改采集商品;参考AE-商品：发布产品信息（aliexpress.postproduct.redefining.postaeproduct）
     */
    @RepeatSubmit()
    @PutMapping()
    public R<Void> edit(@Validated(EditGroup.class) @RequestBody ErpCollectProductBo bo) {
        return toAjax(iErpCollectProductService.updateByBo(bo));
    }

    /**
     * 删除采集商品;参考AE-商品：发布产品信息（aliexpress.postproduct.redefining.postaeproduct）
     *
     * @param ids 主键串
     */
    @DeleteMapping("/{ids}")
    public R<String> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] ids) {
        return iErpCollectProductService.deleteWithValidByIds(Arrays.asList(ids), true);
    }

    @GetMapping("/copyProd")
    public R<Void> copyProd(Long productId) {
        return toAjax(iErpCollectProductService.copyProd(productId));
    }

    /**
     * 修改商品上下架状态
     *
     * @return
     */
    @GetMapping("/updateStatus")
    public R<Object> updateStatus(Long productId, Integer productStatus) {
        return iErpCollectProductService.updateStatus(productId, productStatus);
    }

    /**
     * 批量上架
     *
     * @param
     * @return
     */
    @Transactional
    @GetMapping("/batchGrounding")
    public R<Object> batchGrounding(String productIds, String type) {
        return iErpCollectProductService.batchGrounding(productIds, type);
    }

    /**
     * 新版下架
     *
     * @param
     * @return
     */
    @Transactional
    @GetMapping("/soldOutCollectProduct")
    public R<Object> soldOutCollectProduct(Long productIds, String type) {
        return iErpCollectProductService.soldOutCollectProduct(productIds, type);
    }

    /**
     * 新版批量下架
     *
     * @param
     * @return
     */
    @Transactional
    @GetMapping("/batchSoldOutCollectProduct")
    public R<Object> batchSoldOutCollectProduct(String productIds, String type) {
        return iErpCollectProductService.batchSoldOutCollectProduct(productIds, type);
    }

    /**
     * 刊登商品
     *
     * @return
     */
    @GetMapping("/publish")
    public R<Object> publish(String productId, @RequestParam(defaultValue = "1") Integer isAI) {
        Long userId = SecurityUtils.getUserId();
        //TODO 待验证 能否获取角色
        String roles = SecurityUtils.getRoles();
        iErpCollectProductService.publish(productId, userId, isAI, roles);
        return R.ok("商品发布中，请到个人产品库查看发布商品");
    }


    @GetMapping("/publishAutoInnerAuth/{productId}/{userId}/{taskId}")
    public R<Object> publishAutoInnerAuth(@PathVariable("productId") String productId, @PathVariable("userId") String userId, @PathVariable("taskId") String taskId) {
        iErpCollectProductService.publishAuto(productId,userId,taskId);
        return R.ok("商品发布中，请到个人产品库查看发布商品");
    }

//    @PostMapping("/publishAutoInnerAuth")
//    public R<Object> publishAutoInnerAuth(@RequestBody Map<String, String> map) {
//        iErpCollectProductService.publishAuto(map);
////        System.out.println(id);
//        return R.ok("商品发布中，请到个人产品库查看发布商品");
//    }

    @GetMapping("/selectEditProductUrlToOss")
    public R<Void> selectEditProductUrlToOss() {
        iErpCollectProductService.selectEditProductUrlToOss();
        return R.ok();
    }

    @GetMapping("/ignoreTranslation")
    public R<Void> ignoreTranslation(Long productId) {
        iErpCollectProductService.ignoreTranslation(productId);
        return R.ok();
    }

    /**
     * 修改商品的sku属性
     *
     * @return
     */
    @GetMapping("/updateSkuProperty")
    public R<Void> updateSkuProperty(Long productId) {
        iErpCollectProductService.updateSkuProperty(productId);
        return R.ok();
    }

    /**
     * 修改商品的sku属性
     *
     * @return
     */
    @PostMapping("/updateSkuPropertyByProductA")
    public R<Object> updateSkuPropertyByProductA(@RequestBody ComputeFreightDto dto) {
        return iErpCollectProductService.updateSkuPropertyByProductA(dto);
    }

    /**
     * 系统制图
     *
     * @return
     */
    @GetMapping("/imageMerge")
    public R<Object> imageMerge(Long productId, String imgUrl) {
        Long userId = null;
        try {
            userId = SecurityUtils.getUserId();
        } catch (Exception e) {

        }

        // 根据传过来的地址找到原始地址
        ErpSellerReplaceImageRecord imageRecord = erpSellerReplaceImageRecordMapper
                .selectOne(new LambdaQueryWrapper<ErpSellerReplaceImageRecord>()
                        .eq(ErpSellerReplaceImageRecord::getNewUrl, imgUrl).last("limit 1"));
        if (imageRecord == null)
            return R.fail("制图失败");

        imgUrl = imageRecord.getOldUrl();

        String imageMerge = iErpCollectProductService.ImageMerge(imgUrl, userId, imageRecord.getCollectProductId());
        return R.ok("制图成功", imageMerge);
    }

    /**
     * 获取可进行测试发布店铺
     */
    @GetMapping("/getAutoTestStoreList")
    public R<Object> getAutoTestStoreList(Long collectProductId, Integer type) {
        return iErpCollectProductUploadTestTaskService.getAutoTestStoreList(collectProductId, type);
    }

    /**
     * 设置批量测试发布
     */
    @GetMapping("/productUploadTestBatch")
    public R<String> productUploadTestBatch(String collectProductIds, Integer type) {
        List<String> collectProductIdList = Arrays.stream(collectProductIds.split(",")).collect(Collectors.toList());
        for (String collectProductIdStr : collectProductIdList) {
            Long collectProductId = Long.valueOf(collectProductIdStr);
            // 查找公共产品
            if (type == 1) {
                ErpCollectProductVo collectProduct = iErpCollectProductService.queryById(collectProductId);
                if (collectProduct == null) {
                    return R.fail("产品" + collectProductId + "不存在");
                }
            } else {
                ErpSellerCollectProductVo collectProduct = iErpSellerCollectProductService.queryById(collectProductId);
                if (collectProduct == null) {
                    return R.fail("产品" + collectProductId + "不存在");
                }
            }

            if (iErpCollectProductService.checkProductUploadTest(collectProductId, type)) {
                // 创建task任务
                ErpCollectProductUploadTestTaskBo task = new ErpCollectProductUploadTestTaskBo();
                task.setStatus(0);
                task.setType(type.toString());
                task.setCollectProductId(collectProductId);
                task.setAddTime(new Date());
                if (type == 1) {
                    iErpCollectProductService.updateUploadTestStatus(collectProductId);
                } else {
                    iErpSellerCollectProductService.updateUploadTestStatus(collectProductId);
                }

                if (!iErpCollectProductUploadTestTaskService.insertByBo(task)) {
                    return R.fail("产品" + collectProductId + "测试发布失败");
                }
            } else {
                return R.fail("产品:" + collectProductId + "请完成前置条件后再进行发布");
            }
        }
        return R.ok("已全部测试发布");
    }

    /**
     * 设置取消进行测试发布
     */
    @GetMapping("/cancelUploadTest")
    public R<Object> cancelUploadTest(Long collectProductId, Integer type) {
        ErpCollectProductUploadTestTask task = erpCollectProductUploadTestTaskMapper
                .selectOne(new LambdaQueryWrapper<ErpCollectProductUploadTestTask>()
                        .eq(ErpCollectProductUploadTestTask::getCollectProductId, collectProductId)
                        .eq(ErpCollectProductUploadTestTask::getStatus, 0)
                        .eq(ErpCollectProductUploadTestTask::getType, type));
        if (task != null) {
            return iErpCollectProductUploadTestTaskService.cancelUploadTest(task);
        } else {
            return R.fail("该商品当前不可取消测试发布");
        }
    }

    /**
     * 设置测试公共产品发布
     */
    @GetMapping("/productUploadTest")
    public R<String> productUploadTest(Long collectProductId, Integer type) {
        // 查找公共产品
        if (type == 1) {
            ErpCollectProductVo collectProduct = iErpCollectProductService.queryById(collectProductId);
            if (collectProduct == null) {
                return R.fail("该产品不存在");
            }
        } else {
            ErpSellerCollectProductVo collectProduct = iErpSellerCollectProductService.queryById(collectProductId);
            if (collectProduct == null) {
                return R.fail("该产品不存在");
            }
        }

        if (iErpCollectProductService.checkProductUploadTest(collectProductId, type)) {
            // 创建task任务
            ErpCollectProductUploadTestTaskBo task = new ErpCollectProductUploadTestTaskBo();
            task.setStatus(0);
            task.setType(type.toString());
            task.setCollectProductId(collectProductId);
            task.setAddTime(new Date());
            if (type == 1) {
                iErpCollectProductService.updateUploadTestStatus(collectProductId);
            } else {
                iErpSellerCollectProductService.updateUploadTestStatus(collectProductId);
            }

            if (iErpCollectProductUploadTestTaskService.insertByBo(task)) {
                return R.ok("等待测试中");
            } else {
                return R.fail("产品测试失败");
            }
        } else {
            return R.fail("请完成前置条件");
        }

    }

    @GetMapping("/pushSkuPrice")
    public R<Void> pushSkuPrice() {
        iErpCollectProductService.pushSkuPrice();
        return R.ok();
    }

    /**
     * 获取上载测试失败原因
     */
    @GetMapping("/getUploadTestFailReason")
    public String getUploadTestFailReason(Long collectProductId) {
        LambdaQueryWrapper<ErpCollectProductUploadTestTask> lqw = new LambdaQueryWrapper<ErpCollectProductUploadTestTask>();
        lqw.eq(ErpCollectProductUploadTestTask::getCollectProductId, collectProductId);
        lqw.orderByDesc(ErpCollectProductUploadTestTask::getAddTime);
        lqw.last("limit 1");
        ErpCollectProductUploadTestTask erpCollectProductUploadTestTask = erpCollectProductUploadTestTaskMapper
                .selectOne(lqw);
        if (erpCollectProductUploadTestTask != null) {
            if (erpCollectProductUploadTestTask.getStatus() != 2) {
                // 创建一个 SimpleDateFormat 对象，指定日期格式
                return "失败原因为:" + erpCollectProductUploadTestTask.getRemark();
            } else {
                return "测试通过";
            }
        } else {
            return "暂无测试信息";
        }
    }

    /**
     * 修改类目下的商品多规格变为单规格
     *
     * @return
     */
    @GetMapping("/updateCateGoryPro")
    public R<Void> updateCateGoryPro() {
        iErpCollectProductService.updateCateGoryPro();
        return R.ok();
    }

    /**
     * 根据商品id合并规格
     *
     * @return
     */
    @GetMapping("/updateCateGoryProById")
    public R<Void> updateCateGoryProById(Long proId) {
        iErpCollectProductService.updateCateGoryProById(proId);
        return R.ok();
    }

    /**
     * 修改重复的skucode
     *
     * @return
     */
    @GetMapping("/updateRepeatSkuCode")
    public R<Void> updateRepeatSkuCode() {
        iErpCollectProductService.updateRepeatSkuCode();
        return R.ok();
    }

    /**
     * 添加到个人采集表
     *
     * @return
     */
    @GetMapping("/addToSellerPro")
    public R<Void> addToSellerPro(String prods) {
        iErpCollectProductService.addToSellerPro(prods);
        return R.ok();
    }

    /**
     * 修改公共采集已上架的商品的价格（调用此方法前，先进行运费试算，本方法只是修改个人产品库的价格和采集商品的区域定价）
     *
     * @return
     */
    @GetMapping("/updateGroundingPro")
    public R<Void> updateGroundingPro() {
        iErpCollectProductService.updateGroundingPro();
        return R.ok();
    }

    /**
     * 修改个人采集已上架的商品的价格（调用此方法前，先进行运费试算，本方法只是修改个人产品库的价格和采集商品的区域定价）
     *
     * @return
     */
    @GetMapping("/updatePersonalGroundingPro")
    public R<Void> updatePersonalGroundingPro() {
        iErpCollectProductService.updatePersonalGroundingPro();
        return R.ok();
    }

    /**
     * 拆分商品（大包和经济）
     *
     * @return
     */
    @GetMapping("/splitPro")
    public R<Void> splitPro() {
        iErpCollectProductService.splitPro();
        return R.ok();
    }

    @GetMapping("/getSkuPriceByProIdAndTemId")
    public R<Object> getSkuPriceByProIdAndTemId(Long productId, Integer templateId) {
        Map<String, Object> skuPriceByProIdAndTemId = iErpCollectProductSkuPriceService
                .getSkuPriceByProIdAndTemId(productId, templateId);
        return R.ok(skuPriceByProIdAndTemId);
    }

    /**
     * 已完成未翻译变为已翻译未确认
     */
    @PostMapping("/translated")
    public R<Object> translated(@RequestBody ErpCollectProduct collectProduct) {
//		boolean b = iErpCollectProductService.updateProductImgAndDel(collectProduct);
//		if (b) {
//			ErpCollectProductExpand productExpand = iErpCollectProductExpandService.selectByCollectProductId(collectProduct.getCollectUserId());
//			productExpand.setEditStatus(3);
//			iErpCollectProductExpandService.updateByBo(BeanUtil.toBean(productExpand, ErpCollectProductExpandBo.class));
//		}else {
//			return R.fail();
//		}
        return R.ok();
    }

    @PostMapping("/confirmTranslate")
    public R<Object> confirmTranslate(@RequestBody ErpCollectProductBo collectProduct) {
        boolean b = iErpCollectProductService.updateProductImgAndDel(collectProduct);
        if (b) {
            ErpCollectProductExpand productExpand = iErpCollectProductExpandService
                    .selectByCollectProductId(collectProduct.getId());
            productExpand.setEditStatus(collectProduct.getEditStatus());
            Boolean flag = iErpCollectProductExpandService
                    .updateByBo(BeanUtil.toBean(productExpand, ErpCollectProductExpandBo.class));
            if (flag) {
                return R.ok();
            }
        }
        return R.fail();
    }


    /**
     * 生成白底图
     *
     * @return
     */
    @GetMapping("/generateWhite")
    public R<Object> generateWhite(String imgUrl) {
        return iErpCollectProductService.generateWhite(imgUrl);
    }

    /**
     * 生成营销图
     *
     * @return
     */
    @GetMapping("/generateMarketing")
    public R<Object> generateMarketing(String imgUrl) {
        return iErpCollectProductService.generateMarketing(imgUrl);
    }

    /**
     * 自动生成营销或白底图
     *
     * @param collectProductId
     * @return
     */
    @GetMapping("/autoGenerateMarketingOrWhite")
    public R<Object> autoGenerateMarketingOrWhite(String collectProductId) {

        return iErpCollectProductService.autoGenerateMarketingOrWhite(collectProductId);
    }

    /**
     * 保存营销图白底图轮播图
     */
    @PostMapping("/saveMarketAndWhite")
    public R<Object> saveMarketAndWhite(@RequestBody String stringJson) {
        JSONObject jsonObject = JSONObject.parseObject(stringJson);
        Map<String, Object> map = new HashMap<>(jsonObject);
        String whiteImg = (String) map.get("whiteImg");
        String marketImg = (String) map.get("marketImg");
        String productId = (String) map.get("productId");
//		Integer type = (Integer) map.get("type");
        String imageURLs = (String) map.get("imageURLs");
        if (productId == null) {
            return R.fail("参数错误");
        }

        ErpSellerCollectProductVo erpSellerCollectProductVo = iErpSellerCollectProductService.queryById(Long.valueOf(productId));
        if (erpSellerCollectProductVo == null) {
            return R.fail("找不到商品");
        }
        if (marketImg != null)
            erpSellerCollectProductVo.setMarketing(marketImg);
        if (whiteImg != null)
            erpSellerCollectProductVo.setWhite(whiteImg);
        if (imageURLs != null)
            erpSellerCollectProductVo.setImageURLs(imageURLs);
        collectProductMapper.updateById(BeanUtil.toBean(erpSellerCollectProductVo, ErpCollectProduct.class));
        // 查看类目是否是最底层
        Long categoryId = erpSellerCollectProductVo.getCategoryId();
//		if (categoryId == null) {
        Boolean bottomLevel = erpCollectProductCategoryService.judgeIsBottomLevel(categoryId);
        if (!bottomLevel) {
            // 根据标题获取类目
            iErpCollectProductService.updateCategoryInfo(BeanUtil.toBean(erpSellerCollectProductVo, ErpCollectProduct.class));
        } else {
            ErpCollectProductExpand collectProductExpand = iErpCollectProductExpandService.selectByCollectProductId(Long.parseLong(productId));
            collectProductExpand.setIsAutoOptimize(1);
            collectProductExpand.setAutoOptimizeRemark("填写的类目已是最底级");
            collectProductExpandMapper.updateById(collectProductExpand);
        }
//		}
        // 判断产品属性是否为空
        if (erpSellerCollectProductVo.getCustomAttributes() == null) {
            iErpCollectProductService.updateCustomAttributesByCategory(Long.valueOf(productId));
        }

        return R.ok();
    }


    @GetMapping("/queryCategoryBySubject/{subject}")
    public R<Object> queryCategoryBySubject(@PathVariable("subject") String subject){
        return iErpCollectProductService.queryCategoryBySubject(subject);
    }

    /**
     * 详情图
     */
    @PostMapping("/saveDetailsImg")
    public R<Object> saveDetails(@RequestBody String stringJson) {
        JSONObject jsonObject = JSONObject.parseObject(stringJson);
        Map<String, Object> map = new HashMap<>(jsonObject);
        String detailsImg = (String) map.get("detailsImg");
        String productId = (String) map.get("productId");
        if (productId == null) {
            return R.fail();
        }
        if (detailsImg != null) {
            ErpSellerCollectProductVo erpSellerCollectProductVo = iErpSellerCollectProductService.queryById(Long.valueOf(productId));
            erpSellerCollectProductVo.setDetailImg(detailsImg);
            int update = sellerCollectProductMapper.updateById(BeanUtil.toBean(erpSellerCollectProductVo, ErpSellerCollectProduct.class));
            if (update > 0) {
                return R.ok();
            }
        }
        return R.fail();
    }

    /**
     * 获取店铺类目
     *
     * @param collectId
     * @return
     */
    @GetMapping("/getCollectProductCategoryInfo")
    public R<Object> getCollectProductCategoryInfo(Long collectId) {
        return iErpCollectProductService.getCollectProductCategoryInfo(collectId);
    }

    /**
     * 内部类调用 获取店铺类目
     * @param collectId
     * @return
     */
    @GetMapping("/getCollectProductCategoryInfoInner/{collectId}")
    public R<Object> getCollectProductCategoryInfoInner(@PathVariable("collectId") Long collectId) {
        return iErpCollectProductService.getCollectProductCategoryInfo(collectId);
    }

    /**
     * 删除重复的产品
     */
    @GetMapping("/deleteDuplicateProduct")
    public R<Object> deleteDuplicateProduct() {
//        return iErpCollectProductService.deleteDuplicateProduct();
        return iErpCollectProductService.deleteDuplicateProductThree();
    }

    /**
     * 删除重复的产品
     */
    @GetMapping("/getCollectProductInfoById/{id}")
    public R<Object> getCollectProductInfoById(@PathVariable("id") Long id) {
        return iErpCollectProductService.getCollectProductInfoById(id);
    }

    /**
     *
     */
    @GetMapping("/setProToOrder/{skuCode}")
    public R<Object> setProToOrder(@PathVariable("skuCode") String skuCode) {
        iErpCollectProductService.setProToOrder(skuCode);
        return R.ok();
    }

    /**
     * 查询海关编码
     */
    @GetMapping("/getHsCodeList")
    public R<Object> getHsCodeList(ErpCollectProductHsBo bo) {
        List<ErpCollectProductHsVo> queryList = collectProductHsService.queryList(bo);
        List<Map<String, Object>> list = new ArrayList<>();
        queryList.forEach(vo -> {
            Map<String, Object> map = new HashMap<>();
            map.put("label", vo.getCiqName());
            map.put("value", vo.getId());
            list.add(map);
        });
        return R.ok(list);
    }

    /**
     * 将目标产品进行64国运费试算
     */
    @GetMapping("/queryProductComputeFreight64")
    public R<Object> queryProductComputeFreight64() {
        return iErpCollectProductService.queryProductComputeFreight64();
    }

}
